[JavaScript] How to get the uri of the .js file itself.
Posted
by Vikrant Chaudhary
on Stack Overflow
See other posts from Stack Overflow
or by Vikrant Chaudhary
Published on 2010-06-03T14:38:57Z
Indexed on
2010/06/03
14:44 UTC
Read the original article
Hit count: 270
JavaScript
Hi, is there a method in JavaScript by which I can find out the path/uri of the executing script.
For example:
index.html
includes a JavaScript filestuff.js
and sincestuff.js
file depends on./commons.js
, it wants to include it too in the page. Problem is thatstuff.js
only knows the relative path of./commons.js
from itself and has no clue of full url/path.index.html
includesstuff.js
file as<script src="http://example.net/js/stuff.js?key=value" />
andstuff.js
file wants to read the value ofkey
. How to?
© Stack Overflow or respective owner